package com.lhy.skywalking.user.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.lhy.skywalking.user.dto.UserDTO;
import com.lhy.skywalking.user.entity.User;
import com.lhy.skywalking.user.mapper.UserMapper;
import com.lhy.skywalking.user.service.UserService;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;

@Service
public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements UserService {

    @Override
    public UserDTO getUserById(long id) {
        User user = super.getById(id);
        if (user != null) {
            UserDTO dto = new UserDTO();
            BeanUtils.copyProperties(user, dto);
            return dto;
        }
        return null;
    }
}
